<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>  
    <title>Geek event finder: enter location</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAZJYXK-Ld-mTstzJHt7_KzBQUQcbO9FaM5kTkUQsQG64Twt_yyhS0SgjHS3Ee-v3g_7pWt6hNbLjCIw"
      type="text/javascript">
    </script> 
    <script type="text/javascript">
    
      function waitThenSubmit(sec) {
        findPlace();
        setTimeout("document.forms[0].submit();", sec * 1000);
        return false;
      }      
      
      function setLatLong(loc)
      {
        latitude = loc.Point.coordinates[1];
        longitude = loc.Point.coordinates[0];
        address = loc.Point.address;
       
        document.getElementById('latitude').value = latitude;
        document.getElementById('longitude').value = longitude;
        document.getElementById('loc').value = address;       
      }
      
      function findPlace()
      {
        geocoder = new GClientGeocoder();
        place = document.getElementById('place').value;
        geocoder.getLocations(place, function (response) {
          if (response.Status.code == 200) {
            loc = response.Placemark[0];
            setLatLong(loc);
            document.forms[0].submit();
            }
          else
            {
            alert('Google geocode server returned ' + response.Status.code + '; try again later?');
            }
          }
        );
        document.getElementById('waitnotice').style.display="block";        
      }     
    </script>
      
  </head>
  <body>
    <form action="findEvents" method="post"
     onsubmit="return waitThenSubmit(300);">
      <div>Your location
        <input name="place" id="place"></input>
      </div>
      
      <input type="hidden" name="loc" id="loc" value="none entered" />
      <input type="hidden" name="latitude" id="latitude" value="41" />
      <input type="hidden" name="longitude" id="longitude" value="-81" />
      <input type="hidden" name="radius" id="radius" value="0.5" />
      <div><input type="submit" value="Find Events"></input></div>
    </form>
    <h3 id="waitnotice" style="display:none">Submitted; waiting for data from server...</h3>
    <p>The Geek Event Finder does its best to determine meeting times based on the text it finds on webpages.  The data has <em>not been sanity-checked by a human!</em>  Investigate the event at its website before you place the slightest confidence in it.</p>
  </body>
</html>